﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDir>
#include <QTreeWidgetItem>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

struct MyInfo
{
    QString name;
    uint64_t size;
    QList<MyInfo> childes;
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pushButton_clicked();

    void on_lineEdit_2_textChanged(const QString &arg1);

    void on_lineEdit_4_textChanged(const QString &arg1);

private:
    Ui::MainWindow *ui;
    int m_maxLevel;

    MyInfo m_info;
    QStringList m_excludeFlags;

    QString MemNumToStr(uint64_t v);

    void Calc(const QDir &dir, MyInfo& info, uint64_t& size);
    uint64_t CalcSize(const QString path);
    void ShowTreeWidget();

    void ShowTreeWidgetRecursion(QTreeWidgetItem* parent, MyInfo& info, int level);
};
#endif // MAINWINDOW_H
